package com.service.bean;

import java.sql.Timestamp;
import java.text.MessageFormat;

/**
 * 运料车
 * @author wt
 *
 */
public class Road_GpsSignal_Dumper extends Road_GpsSignal {

	// ---------------------以下为基础值--------------------------

	/**
	 * 射频编号
	 */
	public String rfid;
	/**
	 * 沥青温度
	 */
	public double dumperTemp;
	/**
	 * 温度开关量
	 */
	public int tempStatus;	

	public Object[] getAll() {
		Object[] array = new Object[18];
		array[0] = "'"  + this.signalId + "'";
		array[1] = "'" + this.equipmentId + "'";
		array[2] = "'" + this.gpsNo + "'";
		array[3] = this.gpsTime == null ? this.gpsTime : "'" + new Timestamp(this.gpsTime.getTime()) + "'";
		array[4] = String.valueOf(this.lng);
		array[5] = String.valueOf(this.lat);
		array[6] = String.valueOf(this.baiduLng);
		array[7] = String.valueOf(this.baiduLat);
		array[8] = this.accStatus;
		array[9] = String.valueOf(this.dumperTemp);
		array[10] = this.tempStatus;
		array[11] = "'" + this.rfid + "'";
		array[12] = "'" + this.companyCode + "'";
		array[13] = String.valueOf(this.speed);
		array[14] = String.valueOf(this.oilAmtCal);
		array[15] = String.valueOf(this.totalMile);
		array[16] = String.valueOf(this.gpsStatus);
		array[17] = String.valueOf(this.curMile);

		return array;
	}
	
	public Object[] getAllForJson() {
		Object[] array = getAll();
		array[0] = "\""  + this.signalId + "\"";
		array[1] = "\""  + this.equipmentId + "\"";
		array[2] = "\"" + this.gpsNo + "\"";
		array[3] = this.gpsTime == null ? this.gpsTime : "\"" + new Timestamp(this.gpsTime.getTime()) + "\"";	
		array[11] = "\""  + this.rfid + "\"";
		array[12] = "\""  + this.companyCode + "\"";
		
		return array;
	}
	
	public String toString() {
		StringBuilder sBuilder = new StringBuilder();
		sBuilder.append("\"SignalId\":{0},");
		sBuilder.append("\"EquipmentId\":{1},");
		sBuilder.append("\"GPSNO\":{2},");
		sBuilder.append("\"GPSTime\":{3},");
		sBuilder.append("\"Lng\":{4},");
		sBuilder.append("\"Lat\":{5},");
		sBuilder.append("\"BaiduLng\":{6},");
		sBuilder.append("\"BaiduLat\":{7},");
		sBuilder.append("\"AccStatus\":{8},");
		sBuilder.append("\"DumperTemp\":{9},");
		sBuilder.append("\"TempStatus\":{10},");
		sBuilder.append("\"RFID\":{11},");
		sBuilder.append("\"CompanyCode\":{12},");
		sBuilder.append("\"Speed\":{13},");
		sBuilder.append("\"OilAmtCal\":{14},");
		sBuilder.append("\"TotalMile\":{15},");
		sBuilder.append("\"GPSStatus\":{16},");
		sBuilder.append("\"CurMile\":{17}");
				
		return MessageFormat.format(sBuilder.toString(),this.getAllForJson());
	}
}
